package com.foreknow.view;

import com.foreknow.bean.Guestbook;
import com.foreknow.service.impl.GuestbookServiceImpl;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Select extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	public static  Guestbook guestbook;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Select frame = new Select();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Select() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblid = new JLabel("\u8D3C\u7CBE\u51C6\u7684\u67E5\u8BE2---\u8BF7\u8F93\u5165ID");
		lblid.setFont(new Font("����", Font.PLAIN, 18));
		lblid.setBounds(99, 36, 215, 36);
		contentPane.add(lblid);
		
		JButton btnNewButton = new JButton("\u8D3C\u7CBE\u51C6\u67E5\u8BE2");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				GuestbookServiceImpl guestbookService = new GuestbookServiceImpl();
				Integer a = Integer.parseInt(textField.getText());
				guestbook = guestbookService.query(a);
				Selectjieguoji selectjieguoji = new Selectjieguoji();
				Select.this.dispose();
			}
		});
		btnNewButton.setBounds(163, 161, 93, 23);
		contentPane.add(btnNewButton);
		
		textField = new JTextField();
		textField.setBounds(174, 108, 66, 21);
		contentPane.add(textField);
		textField.setColumns(10);
		this.setVisible(true);
	}
}
